﻿<?php $this->load->view('layout/header'); ?>
<form name="form1" method="post" action="<?php echo $post_url; ?>" id="form1">
    <div id="container">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
            <tr class="table_form_title">
                <td colspan="4">
                    <span id="lblTitle"><?php echo isset($template['templateid']) ? '修改' : '添加'; ?></span>栏目模板
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>栏目属性：
                </td>
                <td>
                    <select name="classpropertyid" id="classpropertyid">
                        <option value="-1">请选择</option>
                        <?php foreach ($class_property as $k => $v) { ?>
                            <option <?php echo $template['classpropertyid'] == $v['classpropertyid'] ? 'selected="selected" ' : ''; ?> value="<?php echo $v['classpropertyid']; ?>"><?php echo $v['propertyname']; ?></option>
                        <?php } ?>
                    </select>
                    <span id="classpropertyid_tips" style="color:Red;display:none;">请选择</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>模板名称：
                </td>
                <td>
                    <input name="templatename" value="<?php echo $template['templatename']; ?>" type="text" id="templatename" />
                    <span id="templatename_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>模板路径：
                </td>
                <td>
                    <input name="templatepath" value="<?php echo $template['templatepath']; ?>" type="text" id="templatepath" style="width:500px;" />
                    <span id="templatepath_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>排序号：
                </td>
                <td>
                    <input name="listid" type="text" num="true" value="<?php echo $template['listid']; ?>" id="listid" />
                    <span id="listid_tips" style="color:Red;display:none;">不能为空</span>
                    <span id="listid_num_tips" style="color:Red;display:none;">只能为数字</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    是否关闭：
                </td>
                <td>
                    <span id="radIsClose">
                        <input id="radIsClose_0" type="radio" name="isclose" value="1" <?php echo $template['isclose'] == 1 ? 'checked="checked" ' : ''; ?>/>
                        <label for="radIsClose_0">是</label>
                        <input id="radIsClose_1" type="radio" name="isclose" value="0" <?php echo $template['isclose'] == 0 ? 'checked="checked" ' : ''; ?>/>
                        <label for="radIsClose_1">否</label>
                    </span>
                </td>
            </tr>
            <tr class="table_form_btn">
                <td align="right">&nbsp;
                    
                </td>
                <td colspan="3">
                    <input type="submit" name="btnSave" value="保存" id="btnSave" />
                    <input type="button" name="Submit" value="返回" onclick="javascript:history.go(-1);" />
                    <span id="errMsg" style="color:Red;"></span>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
    $('#templatename,#listid,#templatepath').change(function() {
        input_tips($(this));
    });
    $('#classpropertyid').change(function() {
        selete_tips($(this));
    });
    $('#form1').submit(function() {
        var is = true;
        if (!selete_tips($('#classpropertyid'))) {
            is = false;
        }
        if (!input_tips($('#templatename'))) {
            is = false;
        }
        if (!input_tips($('#listid'))) {
            is = false;
        }
        if (!input_tips($('#templatepath'))) {
            is = false;
        }
        return is;
    });
</script>
<?php $this->load->view('layout/footer'); ?>